package cn.lhl.action;

import cn.lhl.beans.Stuck;
import cn.lhl.service.IStuckService;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2017/4/6/006.
 */
@Controller
@ParentPackage("struts-default")
@Namespace("/")
public class StuckAction extends ActionSupport{
    @Resource
    private IStuckService service;
    private Stuck stuck;
    @Action(value = "add", results = { @Result(name = SUCCESS, location = "/index.jsp", type = "dispatcher") })
    public String add(){
        service.addStuck(stuck);
        return SUCCESS;
    }

    public IStuckService getService() {
        return service;
    }

    public void setService(IStuckService service) {
        this.service = service;
    }

    public Stuck getStuck() {
        return stuck;
    }

    public void setStuck(Stuck stuck) {
        this.stuck = stuck;
    }
}
